package com.wealth.scsj.b_app.view.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wealth.scsj.b_app.R;
import com.wealth.scsj.b_app.adapter.AccountShopListAdapter;
import com.wealth.scsj.b_app.bean.ShopSwitchListBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 当前账号页面 （商铺切换页面）
 * @author qxp
 */
public class ShopSwitchPageActivity extends BaseActivity implements AccountShopListAdapter.SwitchOnClick{

    private ImageView mBtnBack;
    private TextView mTvTopTittle;
    private ImageView mAccountLogoIv;
    private TextView mUserAccountValueTv;
    private TextView mShopBindListNumberTv;
    private RecyclerView mShopBindListRv;

    AccountShopListAdapter mAdapter;

    List<ShopSwitchListBean> shopList =new ArrayList<>();

    @Override
    protected void createView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_shop_switch_page);
    }

    @Override
    protected void initView() {

        mBtnBack = findViewById(R.id.btn_back);
        mTvTopTittle = findViewById(R.id.tv_top_tittle);
        mAccountLogoIv = findViewById(R.id.account_logo_iv);
        mUserAccountValueTv = findViewById(R.id.user_account_value_tv);
        mShopBindListNumberTv = findViewById(R.id.shop_bind_list_number_tv);
        mShopBindListRv = findViewById(R.id.shop_bind_list_rv);
    }

    @Override
    protected void initListener() {

        mBtnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    protected void initData() {

        mTvTopTittle.setText("当前账号");
        mShopBindListRv.setLayoutManager(new LinearLayoutManager(
                ShopSwitchPageActivity.this, LinearLayoutManager.VERTICAL, false));

        for(int i =0;i<4;i++){
            ShopSwitchListBean bean =new ShopSwitchListBean();

            bean.setShop_logo("1"+i);
            bean.setShop_name("商超糖果店"+i);
            if(i ==0){
                bean.setShop_select(1);
            }else{
                bean.setShop_select(2);
            }
            shopList.add(bean);
        }
        mAdapter =new AccountShopListAdapter(ShopSwitchPageActivity.this,shopList);

        mShopBindListRv.setAdapter(mAdapter);
    }

    /**
     * 切换按钮点击事件
     * @param position
     */
    @Override
    public void onclick(int position) {
        //TODO
    }
}
